﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.AppearanceModelCommand;
using IntelligentAgriculture.WebAPI.Application.Command.BodyMeasureModel;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.BodyMeasureModelCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.AppearanceModelCommandHandler
{
    public class AppearanceModelQueryCommandHandler : IRequestHandler<AppearanceModelQueryCommand, Results<PageOutput<AppearanceModelOutPut>>>
    {

        private readonly IAppearanceModelService appearanceModelService;
        private readonly ILogger<AppearanceModelQueryCommandHandler> logger;
        public AppearanceModelQueryCommandHandler(IAppearanceModelService appearanceModelService, ILogger<AppearanceModelQueryCommandHandler> logger)
        {
            this.appearanceModelService = appearanceModelService;
            this.logger = logger;
        }

        public async Task<Results<PageOutput<AppearanceModelOutPut>>> Handle(AppearanceModelQueryCommand request, CancellationToken cancellationToken)
        {

            var list = await appearanceModelService.AppearanceModellList(request.Appearance);
            var results = Results<PageOutput<AppearanceModelOutPut>>.DataResult(list);
            return results;

        }




    }




}
